#include <bits/stdc++.h>
using namespace std;
int a[1000500],h[1000500];
signed main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,maxn=0,minn=INT_MAX;
    cin>>n;
    for (int i=1;i<=n;i++){
        cin>>a[i];
        //if (a[i]==0) cout<<"sb"<<endl;
        maxn=max(a[i],maxn);
        minn=min(a[i],minn);
        h[a[i]]++;
    }
    /*cout<<minn<<endl<<maxn<<endl;
    for (int i=minn;i<=maxn;i++){
        cout<<h[i]<<endl;
    }*/
    int x=h[minn],ans=0;
    for (int i=minn+1;i<=maxn;i++){
        if (h[i]!=0){
            int b=h[i];
            if (x>=b){
                ans+=b;
            }
            else {
                ans+=x;
                x=b;
            }
        }
    }
    //cout<<h[2]<<endl<<h[1]<<endl;
    cout<<n-ans;
    return 0;
}
